* What Do Voters Think About the Descriptive Underrepresentation of the Working Class?
* Nicholas Carnes and Noam Lupu
* Stata Code
* File updated 7 December 2021

* installing estout (for esttab command below)
ssc install estout, replace

**** Figure 1

* Argentina

* set directory to folder where data are stored
use "APES 2015 panel v7.dta", replace

*workers in labor force
summarize P89_w2 if P89_w2<=100 [weight=weight]

*workers in office
summarize P90_w2 if P90_w2<=100 [weight=weight]

*ideal workers in office
summarize P91_w2 if P91_w2<=100 [weight=weight]

*women in labor force
summarize P86_w2 if P86_w2<=100 [weight=weight]

*women in office
summarize P87_w2 if P87_w2<=100 [weight=weight]

*ideal women in office
summarize P88_w2 if P88_w2<=100 [weight=weight]


* Britain

* set directory to folder where data are stored
use "VanderbiltUniversity_160728_Client_V2.dta" , replace

*workers: public, office, ideal office
summarize Q1 Q2 Q3 [weight=W8]

*women: public, office, ideal office
summarize Q5 Q6 Q7 [weight=W8]

* The US

* set directory to folder where data are stored
use "CCES16_DKA_OUTPUT_Feb2017_unmatched.dta", replace

* workers in labor force
summarize DKA307 if DKA307!=-8 [weight=weight]

* workers in office
summarize DKA308 if DKA308!=-8 [weight=weight]

* ideal workers in office 
summarize DKA309 if DKA309!=-8 [weight=weight]
 
 
 
****  Figure 2: Misperceptions are Common

* The US
* set directory to folder where data are stored
use "CCES16_DKA_OUTPUT_Feb2017_unmatched.dta", replace


gen knowledge = 0
replace knowledge = 1 if CC16_321a==1
replace knowledge = 2 if CC16_321b==1

tab knowledge [weight=weight] if DKA307!=-8, sum(DKA307)
tab knowledge [weight=weight] if DKA308!=-8, sum(DKA308)
tab knowledge [weight=weight] if DKA309!=-8, sum(DKA309)

gen income=1 if faminc>=1 & faminc<=5
replace income=2 if faminc>=6 & faminc<=9
replace income =3 if faminc>=9 & faminc<=31

tab income [weight=weight] if DKA307!=-8, sum(DKA307)
tab income [weight=weight] if DKA308!=-8, sum(DKA308)
tab income [weight=weight] if DKA309!=-8, sum(DKA309)

tab CC16_421a [weight=weight] if DKA307!=-8, sum(DKA307)
tab CC16_421a [weight=weight] if DKA308!=-8, sum(DKA308)
tab CC16_421a [weight=weight] if DKA309!=-8, sum(DKA309)


* Britain
* set directory to folder where data are stored
use "VanderbiltUniversity_160728_Client_V2.dta" , replace

gen Q17a_cor = (Q17a==1)
gen Q17b_cor = (Q17b==1)
gen Q17c_cor = (Q17c==2)
gen Q17d_cor = (Q17d==1)
gen Q17e_cor = (Q17e==1)
factor Q17a_cor-Q17e_cor, pcf
alpha Q17a_cor-Q17e_cor
predict knowledge
xtile knowledge4 = knowledge, n(4)

tab knowledge4 [weight=W8], sum(Q1)
tab knowledge4 [weight=W8], sum(Q2)
tab knowledge4 [weight=W8], sum(Q3)

gen income = .
replace income = 1 if Profile_gross_household>=1 & Profile_gross_household<=8
replace income = 2 if Profile_gross_household>=9 & Profile_gross_household<=12
replace income = 3 if Profile_gross_household>=13 & Profile_gross_household<=15

tab income [weight=W8], sum(Q1)
tab income [weight=W8], sum(Q2)
tab income [weight=W8], sum(Q3)

gen labour_conserative = .
replace labour_conserative = 0 if Q9==2
replace labour_conserative = 1 if Q9==1
replace labour_conserative = 0 if Q10==2
replace labour_conserative = 1 if Q10==1

tab labour_conserative [weight=W8], sum(Q1)
tab labour_conserative [weight=W8], sum(Q2)
tab labour_conserative [weight=W8], sum(Q3)



* Argentina

* set directory to folder where data are stored
use "APES 2015 panel v7.dta", clear

* Code occupations 
gen worker = .	
replace worker =1 if P106_w2=="Albanil"
replace worker =1 if P106_w2=="Cajero"
replace worker =1 if P106_w2=="Mecanico Balanza"
replace worker =0 if P106_w2=="abogada"
replace worker =0 if P106_w2=="abogado"
replace worker =0 if P106_w2=="actris"
replace worker =1 if P106_w2=="adjinistrativo"
replace worker =1 if P106_w2=="admijistrativa"
replace worker =1 if P106_w2=="administracion"
replace worker =1 if P106_w2=="administrativa"
replace worker =1 if P106_w2=="administrativo"
replace worker =1 if P106_w2=="administrativo bodega"
replace worker =0 if P106_w2=="administrativo tecnico"
replace worker =1 if P106_w2=="adminustrativs"
replace worker =1 if P106_w2=="admistritativo"
replace worker =1 if P106_w2=="alambrador de campo"
replace worker =1 if P106_w2=="albajil"
replace worker =1 if P106_w2=="albanil"
replace worker =1 if P106_w2=="albanil x cta propia"
replace worker =1 if P106_w2=="albanileria ,pintura ,electricidaf"
replace worker =1 if P106_w2=="albañil"
replace worker =1 if P106_w2=="albañil changas"
replace worker =1 if P106_w2=="albañil por cta propia"
replace worker =1 if P106_w2=="albañil, pintor"
replace worker =1 if P106_w2=="albañileria"
replace worker =1 if P106_w2=="albañileria carpinteria1"
replace worker =1 if P106_w2=="alisados"
replace worker =1 if P106_w2=="aministrativo"
replace worker =0 if P106_w2=="animador de eventos"
replace worker =1 if P106_w2=="armadora de quirofano"
replace worker =1 if P106_w2=="arreglo compresores"
replace worker =0 if P106_w2=="artesana"
replace worker =0 if P106_w2=="asesir de seguros"
replace worker =0 if P106_w2=="asesor financiero"
replace worker =0 if P106_w2=="asesoramiento orvganizacional"
replace worker =0 if P106_w2=="asist de geriatrico"
replace worker =1 if P106_w2=="asminiatrativa"
replace worker =1 if P106_w2=="atencion al publica en tienda"
replace worker =1 if P106_w2=="atencion al publico en agencia de quini"
replace worker =1 if P106_w2=="atencion de comercio"
replace worker =1 if P106_w2=="auxiliar maternal"
replace worker =1 if P106_w2=="ayte cocina"
replace worker =1 if P106_w2=="ayudane de albanil"
replace worker =1 if P106_w2=="ayudante albañil"
replace worker =1 if P106_w2=="ayudante de albanileria"
replace worker =1 if P106_w2=="ayudante de cocina"
replace worker =1 if P106_w2=="ayudante de gasista"
replace worker =1 if P106_w2=="ayudante dr mecanico de moto"
replace worker =1 if P106_w2=="ayudante veterinario"
replace worker =1 if P106_w2=="barrendera municipal subsidiada"
replace worker =1 if P106_w2=="barrido municipal"
replace worker =1 if P106_w2=="bemde topa por cta propia"
replace worker =0 if P106_w2=="bibliotecaria"
replace worker =1 if P106_w2=="bicicletero"
replace worker =0 if P106_w2=="bombero en automotriz"
replace worker =0 if P106_w2=="boxeador"
replace worker =1 if P106_w2=="call center"
replace worker =1 if P106_w2=="camarera"
replace worker =0 if P106_w2=="canillita"
replace worker =1 if P106_w2=="carnicero"
replace worker =1 if P106_w2=="carpinteria"
replace worker =1 if P106_w2=="carpintero"
replace worker =1 if P106_w2=="carrero"
replace worker =1 if P106_w2=="cartonero"
replace worker =0 if P106_w2=="casa de comida"
replace worker =1 if P106_w2=="catnicero"
replace worker =1 if P106_w2=="ccarpintero"
replace worker =0 if P106_w2=="censista terrenos valdios"
replace worker =0 if P106_w2=="ceramista"
replace worker =0 if P106_w2=="ceremonial y protocolo"
replace worker =1 if P106_w2=="cerrajero"
replace worker =0 if P106_w2=="cf on esio aria correo privado"
replace worker =1 if P106_w2=="changad de albañilrria"
replace worker =1 if P106_w2=="changarin carpinteria"
replace worker =1 if P106_w2=="changarin en el mercado central"
replace worker =1 if P106_w2=="changarin limpieza"
replace worker =1 if P106_w2=="changas"
replace worker =1 if P106_w2=="changas de albanil"
replace worker =1 if P106_w2=="changas de albañil"
replace worker =1 if P106_w2=="changas de albañileria"
replace worker =1 if P106_w2=="changas de herrero"
replace worker =1 if P106_w2=="changas de instalacion de aires acondic"
replace worker =1 if P106_w2=="changas en taller mecanico"
replace worker =1 if P106_w2=="changas en vialidad y centro deportivo"
replace worker =1 if P106_w2=="chaperia pijtura autos"
replace worker =1 if P106_w2=="chapista"
replace worker =1 if P106_w2=="chaspista por su cuenta"
replace worker =0 if P106_w2=="chef"
replace worker =1 if P106_w2=="chofer"
replace worker =1 if P106_w2=="chofer ambulancia"
replace worker =1 if P106_w2=="chofer colectivo"
replace worker =1 if P106_w2=="chofer de camion"
replace worker =1 if P106_w2=="chofer de camion de emp"
replace worker =1 if P106_w2=="chofer de combi escolar"
replace worker =1 if P106_w2=="chofer de taxi"
replace worker =1 if P106_w2=="chofer taxi  franquero"
replace worker =1 if P106_w2=="chofer transp escolar"
replace worker =1 if P106_w2=="chofet de rrmise"
replace worker =1 if P106_w2=="chspista"
replace worker =0 if P106_w2=="cobrador"
replace worker =1 if P106_w2=="cocina"
replace worker =1 if P106_w2=="cocina tortas"
replace worker =1 if P106_w2=="cocinera"
replace worker =1 if P106_w2=="cocinera de colegio"
replace worker =1 if P106_w2=="cocinera escuela"
replace worker =1 if P106_w2=="cocinero"
replace worker =1 if P106_w2=="cocins viandss"
replace worker =0 if P106_w2=="comerciante"
replace worker =0 if P106_w2=="comerciante Kiosco"
replace worker =0 if P106_w2=="comerciante atencion en kiosco"
replace worker =0 if P106_w2=="comerciante cuenta propia"
replace worker =0 if P106_w2=="comerciante de rubros generales"
replace worker =0 if P106_w2=="comerciante librero"
replace worker =0 if P106_w2=="comerciante producto para la salud"
replace worker =0 if P106_w2=="comerciante verduleria"
replace worker =0 if P106_w2=="comerciante, verduleria"
replace worker =0 if P106_w2=="comerciante;"
replace worker =0 if P106_w2=="comerciantr"
replace worker =0 if P106_w2=="comercio"
replace worker =0 if P106_w2=="comercio almacen"
replace worker =0 if P106_w2=="comercio de alimentos"
replace worker =0 if P106_w2=="comercio exterior"
replace worker =0 if P106_w2=="comercio ventas"
replace worker =0 if P106_w2=="comersiante"
replace worker =0 if P106_w2=="comerviante"
replace worker =0 if P106_w2=="cometciante"
replace worker =0 if P106_w2=="comrrciante"
replace worker =1 if P106_w2=="conserje"
replace worker =1 if P106_w2=="conserje de escuela"
replace worker =1 if P106_w2=="construccion"
replace worker =1 if P106_w2=="constructor"
replace worker =1 if P106_w2=="constructor de casas"
replace worker =1 if P106_w2=="construcvion"
replace worker =0 if P106_w2=="contador en una bodega"
replace worker =0 if P106_w2=="contadora publica"
replace worker =0 if P106_w2=="contadorq"
replace worker =0 if P106_w2=="contratista"
replace worker =0 if P106_w2=="control de mercaderia en mercado centra"
replace worker =1 if P106_w2=="contruccion"
replace worker =1 if P106_w2=="contruccion albañil"
replace worker =0 if P106_w2=="cooperativa"
replace worker =0 if P106_w2=="coordinadora"
replace worker =1 if P106_w2=="costura"
replace worker =1 if P106_w2=="costura fabrica ropa de chicos"
replace worker =1 if P106_w2=="costurera"
replace worker =1 if P106_w2=="costurera en un taller"
replace worker =1 if P106_w2=="costurers"
replace worker =1 if P106_w2=="cuida autos"
replace worker =0 if P106_w2=="cuida enfermos eventualmene"
replace worker =1 if P106_w2=="cuida niños"
replace worker =0 if P106_w2=="cuida persona mayor"
replace worker =0 if P106_w2=="cuidado de anciajos"
replace worker =0 if P106_w2=="cuidado de ancianos"
replace worker =0 if P106_w2=="cuidadora de ancianos"
replace worker =0 if P106_w2=="cuidando ninos"
replace worker =0 if P106_w2=="decoracion"
replace worker =0 if P106_w2=="depiladora"
replace worker =0 if P106_w2=="descabezadora de an hoitas"
replace worker =0 if P106_w2=="dibujante letrista"
replace worker =0 if P106_w2=="diriero"
replace worker =0 if P106_w2=="diseño de indumentaria"
replace worker =0 if P106_w2=="docencia"
replace worker =0 if P106_w2=="docente"
replace worker =0 if P106_w2=="docente de cine universurarii"
replace worker =0 if P106_w2=="docente escuela publica secundaria"
replace worker =0 if P106_w2=="docente estatal"
replace worker =0 if P106_w2=="docente jardin"
replace worker =0 if P106_w2=="docente profecional"
replace worker =0 if P106_w2=="docente secundario"
replace worker =0 if P106_w2=="docente universidad"
replace worker =0 if P106_w2=="docente, escuela especual"
replace worker =0 if P106_w2=="docente, escuela publica secundaria"
replace worker =0 if P106_w2=="dueno"
replace worker =0 if P106_w2=="dueno  de carniceria"
replace worker =0 if P106_w2=="dueña comercio kiosco"
replace worker =0 if P106_w2=="dueña de jugueteria"
replace worker =0 if P106_w2=="dueña despensa"
replace worker =0 if P106_w2=="dueño metalurgico"
replace worker =0 if P106_w2=="dueñño cssa ropa"
replace worker =0 if P106_w2=="ebanista por su cuenta"
replace worker =0 if P106_w2=="electricidad"
replace worker =1 if P106_w2=="electricista"
replace worker =1 if P106_w2=="electricista y pintor"
replace worker =1 if P106_w2=="elevtromecanico"
replace worker =1 if P106_w2=="embalador de frutas y verduras"
replace worker =1 if P106_w2=="emp adm"
replace worker =1 if P106_w2=="emp domestica"
replace worker =1 if P106_w2=="emp estudio de arquitectura"
replace worker =1 if P106_w2=="emp gastronomico"
replace worker =1 if P106_w2=="emp mant"
replace worker =1 if P106_w2=="emp priv"
replace worker =1 if P106_w2=="empkeada"
replace worker =1 if P106_w2=="empkeado municipal"
replace worker =1 if P106_w2=="empl"
replace worker =1 if P106_w2=="empl adm"
replace worker =1 if P106_w2=="empl comercio"
replace worker =1 if P106_w2=="empl domestica  Niñera"
replace worker =1 if P106_w2=="empl municipal"
replace worker =1 if P106_w2=="empl priv"
replace worker =1 if P106_w2=="empl textil"
replace worker =1 if P106_w2=="empl. administrativo"
replace worker =1 if P106_w2=="empl. afm."
replace worker =1 if P106_w2=="empl. cometcio"
replace worker =1 if P106_w2=="emplada, seguros"
replace worker =1 if P106_w2=="empleada"
replace worker =1 if P106_w2=="empleada administrativa"
replace worker =1 if P106_w2=="empleada bancaria"
replace worker =1 if P106_w2=="empleada comercio"
replace worker =1 if P106_w2=="empleada d comercio"
replace worker =1 if P106_w2=="empleada de comercio"
replace worker =1 if P106_w2=="empleada de comercio almacen"
replace worker =1 if P106_w2=="empleada de deposito odontologico"
replace worker =1 if P106_w2=="empleada de fiambreria"
replace worker =1 if P106_w2=="empleada de local"
replace worker =1 if P106_w2=="empleada de negocii de comida"
replace worker =1 if P106_w2=="empleada domestica"
replace worker =1 if P106_w2=="empleada en puesto de venta de diarios"
replace worker =1 if P106_w2=="empleada judicial"
replace worker =1 if P106_w2=="empleada mc donalds"
replace worker =1 if P106_w2=="empleada negocio ropa"
replace worker =1 if P106_w2=="empleada operario"
replace worker =1 if P106_w2=="empleada policial"
replace worker =1 if P106_w2=="empleada se comercio"
replace worker =1 if P106_w2=="empleada ventas"
replace worker =1 if P106_w2=="empleada,admi"
replace worker =1 if P106_w2=="empleado"
replace worker =1 if P106_w2=="empleado administrativo"
replace worker =1 if P106_w2=="empleado albañil"
replace worker =1 if P106_w2=="empleado chofer"
replace worker =1 if P106_w2=="empleado comercio"
replace worker =1 if P106_w2=="empleado de comercio"
replace worker =1 if P106_w2=="empleado de comercio fereteria"
replace worker =1 if P106_w2=="empleado de comercio pintureria esta co"
replace worker =1 if P106_w2=="empleado de comercio.encargado"
replace worker =1 if P106_w2=="empleado de mantenimienfo"
replace worker =1 if P106_w2=="empleado de transpirte"
replace worker =1 if P106_w2=="empleado dela construccion"
replace worker =1 if P106_w2=="empleado emp, privada"
replace worker =1 if P106_w2=="empleado en curtiembre"
replace worker =1 if P106_w2=="empleado en zanella"
replace worker =1 if P106_w2=="empleado gastronomico"
replace worker =0 if P106_w2=="empleado independiente"
replace worker =1 if P106_w2=="empleado metalurgico"
replace worker =1 if P106_w2=="empleado metalúrgico"
replace worker =1 if P106_w2=="empleado operario"
replace worker =1 if P106_w2=="empleado privado"
replace worker =1 if P106_w2=="empleado publico"
replace worker =1 if P106_w2=="empleado remiseria"
replace worker =1 if P106_w2=="empleado rural maquinarias agricolas"
replace worker =1 if P106_w2=="empleado seguridad"
replace worker =1 if P106_w2=="empleado,operario"
replace worker =1 if P106_w2=="empleadopublico"
replace worker =1 if P106_w2=="empleadp"
replace worker =1 if P106_w2=="empleads"
replace worker =1 if P106_w2=="emplesdo"
replace worker =1 if P106_w2=="emplrado construvcion"
replace worker =0 if P106_w2=="empresa de limpieza"
replace worker =0 if P106_w2=="empresario"
replace worker =0 if P106_w2=="encargado de edificio"
replace worker =0 if P106_w2=="encargado edificio"
replace worker =0 if P106_w2=="encarhado de edificio"
replace worker =0 if P106_w2=="enfermera"
replace worker =1 if P106_w2=="enpleada"
replace worker =1 if P106_w2=="esteticista"
replace worker =0 if P106_w2=="estudio contable"
replace worker =1 if P106_w2=="eventualmente jardinero albañil"
replace worker =0 if P106_w2=="fabrica baterias de auto en fabrica"
replace worker =0 if P106_w2=="fabricante y venta de indumentaria"
replace worker =0 if P106_w2=="filetera"
replace worker =0 if P106_w2=="filetero"
replace worker =0 if P106_w2=="filetero del pesccado"
replace worker =1 if P106_w2=="flete"
replace worker =1 if P106_w2=="fletero"
replace worker =1 if P106_w2=="fletero por cuenta propia"
replace worker =1 if P106_w2=="fletes"
replace worker =0 if P106_w2=="fotografo"
replace worker =0 if P106_w2=="gastista"
replace worker =0 if P106_w2=="gastronomia"
replace worker =0 if P106_w2=="gendarme"
replace worker =0 if P106_w2=="genialogista"
replace worker =0 if P106_w2=="gestoria cuenta propia"
replace worker =0 if P106_w2=="gomeria"
replace worker =1 if P106_w2=="hace carteles publicitarios y pintor"
replace worker =1 if P106_w2=="hace changas"
replace worker =0 if P106_w2=="hace comida por su cuenta"
replace worker =1 if P106_w2=="heladero mostrador"
replace worker =1 if P106_w2=="herrero"
replace worker =0 if P106_w2=="independiente"
replace worker =0 if P106_w2=="ingeniero"
replace worker =1 if P106_w2=="jardinero"
replace worker =1 if P106_w2=="jardinero arreglos"
replace worker =0 if P106_w2=="jefe de control de turno ferrocarril"
replace worker =0 if P106_w2=="jubilado"
replace worker =0 if P106_w2=="jugueeria libretia"
replace worker =0 if P106_w2=="kiosquera"
replace worker =1 if P106_w2=="lava camiones"
replace worker =1 if P106_w2=="lavadero de auto"
replace worker =1 if P106_w2=="libreria empleado"
replace worker =0 if P106_w2=="licenciada en enfermeria"
replace worker =1 if P106_w2=="limpieza"
replace worker =1 if P106_w2=="limpieza cocina en un ctro d contencion"
replace worker =1 if P106_w2=="limpieza de oficinas"
replace worker =1 if P106_w2=="limpieza hotel"
replace worker =0 if P106_w2=="m.m.obra"
replace worker =0 if P106_w2=="madera para artistica"
replace worker =0 if P106_w2=="maestra"
replace worker =0 if P106_w2=="maestranza"
replace worker =0 if P106_w2=="maestranza cine"
replace worker =0 if P106_w2=="maestranza, limpieeza en distribuidora"
replace worker =0 if P106_w2=="maestro de musica"
replace worker =1 if P106_w2=="maestro mayor d obra"
replace worker =1 if P106_w2=="maestro mayor de obra"
replace worker =0 if P106_w2=="maestto panadero"
replace worker =1 if P106_w2=="mantenimiento"
replace worker =1 if P106_w2=="mantenimiento de edifi io"
replace worker =1 if P106_w2=="mantenimiento de pintura"
replace worker =1 if P106_w2=="mantenimiento limpieza edificios"
replace worker =1 if P106_w2=="mantenumuento en ckub"
replace worker =1 if P106_w2=="maquilladora"
replace worker =0 if P106_w2=="marinero mercante"
replace worker =0 if P106_w2=="masajista"
replace worker =1 if P106_w2=="mecanica"
replace worker =1 if P106_w2=="mecanico"
replace worker =1 if P106_w2=="mecanico autos"
replace worker =1 if P106_w2=="mecanico maquinarias parque y jardin"
replace worker =0 if P106_w2=="medica"
replace worker =1 if P106_w2=="mensajeria,empleado"
replace worker =1 if P106_w2=="metalurgico"
replace worker =1 if P106_w2=="minero"
replace worker =0 if P106_w2=="ministerio de educacion"
replace worker =1 if P106_w2=="modista"
replace worker =1 if P106_w2=="modista tejido"
replace worker =1 if P106_w2=="moza"
replace worker =1 if P106_w2=="mozo"
replace worker =0 if P106_w2=="musico"
replace worker =0 if P106_w2=="musicoterapeuta"
replace worker =0 if P106_w2=="negocio"
replace worker =1 if P106_w2=="ninera"
replace worker =1 if P106_w2=="niniera"
replace worker =1 if P106_w2=="niñera"
replace worker =1 if P106_w2=="niñera empleada"
replace worker =0 if P106_w2=="oanaderia"
replace worker =1 if P106_w2=="obrero en fabrica"
replace worker =1 if P106_w2=="operador  textil"
replace worker =1 if P106_w2=="operador call center"
replace worker =1 if P106_w2=="operador de videon"
replace worker =1 if P106_w2=="operador tecnico"
replace worker =1 if P106_w2=="operadortextil"
replace worker =1 if P106_w2=="operaria"
replace worker =1 if P106_w2=="operaria calzado"
replace worker =1 if P106_w2=="operario"
replace worker =1 if P106_w2=="operario en fabrica"
replace worker =1 if P106_w2=="operario en ypf"
replace worker =1 if P106_w2=="operario fabrica"
replace worker =1 if P106_w2=="operario fuerzas armadas"
replace worker =1 if P106_w2=="operario maestranza"
replace worker =1 if P106_w2=="operario metalurgico"
replace worker =1 if P106_w2=="operario municipal"
replace worker =1 if P106_w2=="operaris"
replace worker =1 if P106_w2=="operatio"
replace worker =1 if P106_w2=="paisajista"
replace worker =1 if P106_w2=="panadera artesanal"
replace worker =1 if P106_w2=="panadero"
replace worker =1 if P106_w2=="panadero0"
replace worker =1 if P106_w2=="panes, tirtas y comudas caseeas"
replace worker =1 if P106_w2=="parquero de plazas"
replace worker =1 if P106_w2=="pastelera casera"
replace worker =1 if P106_w2=="pelu1yero"
replace worker =1 if P106_w2=="peluquera"
replace worker =1 if P106_w2=="peluqueria"
replace worker =1 if P106_w2=="peluquero"
replace worker =1 if P106_w2=="peluquero changas"
replace worker =1 if P106_w2=="peon de albanil"
replace worker =1 if P106_w2=="peon en empresa del puerto"
replace worker =1 if P106_w2=="peon obrero"
replace worker =1 if P106_w2=="pintor"
replace worker =1 if P106_w2=="pintor de autos"
replace worker =1 if P106_w2=="plomero"
replace worker =1 if P106_w2=="plomero gasista"
replace worker =0 if P106_w2=="podoliga y maquilladora"
replace worker =0 if P106_w2=="policia"
replace worker =0 if P106_w2=="policia, comisario principal"
replace worker =0 if P106_w2=="pollerua"
replace worker =0 if P106_w2=="portera"
replace worker =0 if P106_w2=="portera auxiliar en colegio"
replace worker =0 if P106_w2=="portero"
replace worker =0 if P106_w2=="preceptora"
replace worker =0 if P106_w2=="procuradora"
replace worker =0 if P106_w2=="producotr de seguros"
replace worker =0 if P106_w2=="profesor"
replace worker =0 if P106_w2=="profesor de arte"
replace worker =0 if P106_w2=="profesora"
replace worker =0 if P106_w2=="profesora escuela publica"
replace worker =0 if P106_w2=="profesora yoga"
replace worker =0 if P106_w2=="programador"
replace worker =0 if P106_w2=="psicologa"
replace worker =0 if P106_w2=="psiquiatra"
replace worker =0 if P106_w2=="quinielero"
replace worker =0 if P106_w2=="reccionista"
replace worker =1 if P106_w2=="recoleccion"
replace worker =1 if P106_w2=="recolector de cartones, o botellas"
replace worker =1 if P106_w2=="recolector residuos"
replace worker =1 if P106_w2=="remise"
replace worker =1 if P106_w2=="remisero"
replace worker =0 if P106_w2=="repartidor de oca"
replace worker =0 if P106_w2=="repartidor de pizza"
replace worker =1 if P106_w2=="repositor"
replace worker =1 if P106_w2=="repositor en un comercio"
replace worker =1 if P106_w2=="reposters"
replace worker =0 if P106_w2=="revestikientos"
replace worker =0 if P106_w2=="salud"
replace worker =1 if P106_w2=="secretaria"
replace worker =1 if P106_w2=="secretaria administrativa"
replace worker =1 if P106_w2=="secretaria en un estudio contable"
replace worker =1 if P106_w2=="secretario"
replace worker =1 if P106_w2=="seguridad"
replace worker =0 if P106_w2=="seguridad vecinal"
replace worker =0 if P106_w2=="seladora"
replace worker =0 if P106_w2=="sereno"
replace worker =0 if P106_w2=="sereno barrial"
replace worker =1 if P106_w2=="sereno municipal"
replace worker =0 if P106_w2=="servicio tecnico"
replace worker =0 if P106_w2=="servicios"
replace worker =1 if P106_w2=="siembra y trabajos agricolas"
replace worker =0 if P106_w2=="soviolaga"
replace worker =0 if P106_w2=="subsidiada municipal servicios urbanos"
replace worker =1 if P106_w2=="supermercado"
replace worker =1 if P106_w2=="taller mecanico"
replace worker =1 if P106_w2=="taxisra"
replace worker =1 if P106_w2=="taxista"
replace worker =0 if P106_w2=="tecnica en redes"
replace worker =0 if P106_w2=="tecnico"
replace worker =0 if P106_w2=="tecnico de pc"
replace worker =0 if P106_w2=="tecnico electronico"
replace worker =0 if P106_w2=="tecnico en futbol"
replace worker =0 if P106_w2=="tecnico informatico"
replace worker =1 if P106_w2=="tecnico radio y tv"
replace worker =1 if P106_w2=="tecnico refrigeracion"
replace worker =0 if P106_w2=="terapista ocupacionsl"
replace worker =1 if P106_w2=="ve dedora ambulante"
replace worker =0 if P106_w2=="vendedor"
replace worker =0 if P106_w2=="vendedor ambulante"
replace worker =0 if P106_w2=="vendedor en jugeteria"
replace worker =0 if P106_w2=="vendedora"
replace worker =0 if P106_w2=="vendedora ambulante"
replace worker =0 if P106_w2=="vendedora cosmeticos"
replace worker =0 if P106_w2=="vendedora en negocio vta de art,de limp"
replace worker =0 if P106_w2=="vendedora local de ropa"
replace worker =0 if P106_w2=="vendedora por cartilla"
replace worker =0 if P106_w2=="vendedpra de ropas"
replace worker =0 if P106_w2=="venderora"
replace worker =0 if P106_w2=="venta de ropa"
replace worker =0 if P106_w2=="venta deautos"
replace worker =0 if P106_w2=="ventas"
replace worker =0 if P106_w2=="ventas de zapatos"
replace worker =0 if P106_w2=="ventas empresa via bariloche"
replace worker =0 if P106_w2=="verduleria"
replace worker =0 if P106_w2=="verduleria propia"
replace worker =0 if P106_w2=="vrnta de vidrios"
replace worker =1 if P106_w2=="álbañilnpor su cuenta"

* Subset Sample by Knowledge

gen know1_cor = (P71_w2==2)
gen know2_cor = (P72_w2==3)
gen know3_cor = (P74_w2==4)
gen know4_cor = (P75_w2==2)
gen know5_cor = (P76_w2==2)
factor know1_cor-know5_cor, pcf
alpha know1_cor-know5_cor
predict knowledge
xtile knowledge3 = knowledge, n(3)

summarize P89_w2 if P89_w2<=100 & knowledge3==1 [weight=weight]
summarize P90_w2 if P90_w2<=100 & knowledge3==1 [weight=weight]
summarize P91_w2 if P91_w2<=100 & knowledge3==1 [weight=weight]

summarize P89_w2 if P89_w2<=100 & knowledge3==3 [weight=weight]
summarize P90_w2 if P90_w2<=100 & knowledge3==3 [weight=weight]
summarize P91_w2 if P91_w2<=100 & knowledge3==3 [weight=weight]


* Subset Sample by Class

summarize P89_w2 if P89_w2<=100 & worker==1 [weight=weight]
summarize P90_w2 if P90_w2<=100 & worker==1 [weight=weight]
summarize P91_w2 if P91_w2<=100 & worker==1 [weight=weight]

summarize P89_w2 if P89_w2<=100 & worker==0 [weight=weight]
summarize P90_w2 if P90_w2<=100 & worker==0 [weight=weight]
summarize P91_w2 if P91_w2<=100 & worker==0 [weight=weight]


* Subset Sample by Party

summarize P89_w2 if P89_w2<=100 & P43_w2==2 [weight=weight]
summarize P90_w2 if P90_w2<=100 & P43_w2==2 [weight=weight]
summarize P91_w2 if P91_w2<=100 & P43_w2==2 [weight=weight]

summarize P89_w2 if P89_w2<=100 & P43_w2==3 [weight=weight]
summarize P90_w2 if P90_w2<=100 & P43_w2==3 [weight=weight]
summarize P91_w2 if P91_w2<=100 & P43_w2==3 [weight=weight]


**** Figure 3: Those who care don’t behave differently

* Argentina
* set directory to folder where data are stored

use "APES 2015 panel v7.dta", clear

gen idealMINUSperceived=P91_w2 - P90_w2 if P91_w2 <=100 & P90_w2<=100
gen idealGROUP = ""
replace idealGROUP = "too many workers" if idealMINUSperceived !=. & idealMINUSperceived<-10 
replace idealGROUP = "about enough workers" if idealMINUSperceived >=-10 & idealMINUSperceived<=10
replace idealGROUP = "too few workers" if idealMINUSperceived >10 & idealMINUSperceived !=.

gen attendmtg = 0 if P29_4!=88 | P29_5!=88 | P23_4_w2!=88 | P23_5_w2!=88
replace attendmtg = 1 if (P29_4>=1 & P29_4<=3) | (P29_5>=1 & P29_5<=3) | (P23_4_w2>=1 & P23_4_w2<=3) | (P23_5_w2>=1 & P23_5_w2<=3)
tab idealGROUP [weight=weight], sum(attendmtg)

gen protest = 0 if P24_1_w2==2 | P24_2_w2==2 | P24_3_w2==2
replace protest = 1 if P24_1_w2==1 | P24_2_w2==1 | P24_3_w2==1
tab idealGROUP [weight=weight], sum(protest)

gen badpolitics = 0 if P1_w2>=1 & P1_w2<=16
replace badpolitics=1 if P1_w2==2 | P1_w2==11
tab idealGROUP [weight=weight], sum(badpolitics)

gen scioli = 0 if (P27_abierta_w2>=1 & P27_abierta_w2<=10) | (P27_cerrada_w2>=1 & P27_cerrada_w2<=10)
replace scioli= 1 if P27_abierta_w2==1 | P27_cerrada_w2==1
tab idealGROUP [weight=weight], sum(scioli)

gen turnout = 1 if (P27_abierta_w2>=1 & P27_abierta_w2<=10) | (P27_cerrada_w2>=1 & P27_cerrada_w2<=10)
replace turnout = 0 if P27_abierta_w2==98
tab idealGROUP [weight=weight], sum(turnout)

gen female = (sexo==2)
rename edad age

gen educ = P102_w2 if P102_w2<11
replace educ = P89b if P89b<11 & educ==.

gen ideol = P39_w2 if P39_w2<11
replace ideol = P36 if P36<11 & ideol==.

foreach x of numlist 1(1)10 {
	gen item`x' = P136_`x'_w2
	replace item`x' = P125_`x' if item`x'==.
}
factor item1-item10, pcf
predict wealthx
xtile wealth = wealthx, n(5)

gen know1_cor = (P71_w2==2)
gen know2_cor = (P72_w2==3)
gen know3_cor = (P74_w2==4)
gen know4_cor = (P75_w2==2)
gen know5_cor = (P76_w2==2)
factor know1_cor-know5_cor, pcf
alpha know1_cor-know5_cor
predict knowledgex
xtile knowledge = knowledgex, n(3)


* The US
* set directory to folder where data are stored
use "CCES16_DKA_OUTPUT_Feb2017_unmatched.dta", replace

gen idealMINUSperceived= DKA309- DKA307 if DKA307!=-8 & DKA309!=-8
gen idealGROUP = ""
replace idealGROUP = "too many workers" if idealMINUSperceived !=. & idealMINUSperceived<-10 
replace idealGROUP = "about enough workers" if idealMINUSperceived >=-10 & idealMINUSperceived<=10
replace idealGROUP = "too few workers" if idealMINUSperceived >10 & idealMINUSperceived !=. 

gen attendmtg= (CC16_417a_1 - 2)*(-1)
tab idealGROUP [weight=weight], sum(attendmtg)

gen turnout = 0 if CC16_401 >=1 & CC16_401<=4
replace turnout = 1 if CC16_401 ==5
tab idealGROUP [weight=weight], sum(turnout)


gen workcandidate = (CC16_417a_3 - 2)*(-1)
tab idealGROUP [weight=weight], sum(workcandidate)

gen disapprove=0 if CC16_320b!=8 & CC16_320b!=.
replace disapprove = 1 if CC16_320b==3 | CC16_320b==4
tab idealGROUP [aweight=weight], sum(disapprove)

gen trump = 0 if CC16_410a==2
replace trump = 1 if CC16_410a==1
tab idealGROUP [aweight=weight], sum(trump)


*Britain
* set directory to folder where data are stored
use "VanderbiltUniversity_160728_Client_V2.dta" , replace

gen idealMINUSperceived= Q3-Q1 
gen idealGROUP = ""
replace idealGROUP = "too many workers" if idealMINUSperceived !=. & idealMINUSperceived<-10 
replace idealGROUP = "about enough workers" if idealMINUSperceived >=-10 & idealMINUSperceived<=10
replace idealGROUP = "too few workers" if idealMINUSperceived >10 & idealMINUSperceived!=.

gen attendmtg = 0 if Q15==4 & Q16==4	
replace attendmtg = 1 if Q15==1 | Q15==2 | Q15==3 | Q16==1 | Q16==2 | Q16==3
tab idealGROUP [weight=W8], sum(attendmtg)

gen protest = (Q14- 2)*(-1) if Q14!=3
tab idealGROUP [weight=W8], sum(protest)

**** Table 2: estimates summarize full models in Tables A7-A9 (below)


**** Table A1: Question Order in Argentina

use "APES 2015 panel v7.dta", clear

tab rotp86_w2, gen(womenrotation_)
tab rotp90_w2, gen(workerrotation_)

*women in public
regress P86_w2 i.womenrotation_* if P86_w2<=100 [weight=weight], robust
est store model1

*women in office
regress P87_w2 i.womenrotation_* if P87_w2<=100 [weight=weight], robust
est store model2

*ideal women in office
regress P88_w2 i.womenrotation_* if P88_w2<=100 [weight=weight], robust
est store model3

*workers in public
regress P89_w2 i.workerrotation_* if P89_w2<=100 [weight=weight], robust
est store model4

*workers in office
regress P90_w2 i.workerrotation_* if P90_w2<=100 [weight=weight], robust
est store model5

*ideal workers in office
regress P91_w2 i.workerrotation_* if P91_w2<=100 [weight=weight], robust
est store model6

esttab model1 model2 model3 model4 model5 model6 using models.csv, b(2) se(2) r2 replace



***** Table A2: Question Order in Britain (Women Block First) 

use "VanderbiltUniversity_160728_Client_V2.dta" , replace

tab m_Block1_rnd, gen(order_)
tab m_Block2_rnd, gen(genderorder_)

*women: public, office, ideal office

regress Q5 genderorder_* if m_Block1and2_rnd=="randomize(1, [1,0])" [weight=W8], robust
est store model1

regress Q6 genderorder_* if m_Block1and2_rnd=="randomize(1, [1,0])" [weight=W8], robust
est store model2

regress Q7 genderorder_* if m_Block1and2_rnd=="randomize(1, [1,0])" [weight=W8], robust
est store model3

*workers: public, office, ideal office
regress Q1 order_* if m_Block1and2_rnd=="randomize(1, [1,0])" [weight=W8], robust
est store model4

regress Q2 order_* if m_Block1and2_rnd=="randomize(1, [1,0])" [weight=W8], robust
est store model5

regress Q3 order_* if m_Block1and2_rnd=="randomize(1, [1,0])" [weight=W8], robust
est store model6


esttab model1 model2 model3 model4 model5 model6 using models.csv, b(2) se(2) r2 replace


***** Table A3: Question Order in Britain (Worker Block First) 

use "VanderbiltUniversity_160728_Client_V2.dta" , replace

tab m_Block1_rnd, gen(order_)
tab m_Block2_rnd, gen(genderorder_)

*women: public, office, ideal office

regress Q5 genderorder_* if m_Block1and2_rnd=="randomize(0, [0,1])" [weight=W8], robust
est store model1

regress Q6 genderorder_* if m_Block1and2_rnd=="randomize(0, [0,1])" [weight=W8], robust
est store model2

regress Q7 genderorder_* if m_Block1and2_rnd=="randomize(0, [0,1])" [weight=W8], robust
est store model3


*workers: public, office, ideal office
regress Q1 order_* if m_Block1and2_rnd=="randomize(0, [0,1])" [weight=W8], robust
est store model4

regress Q2 order_* if m_Block1and2_rnd=="randomize(0, [0,1])" [weight=W8], robust
est store model5

regress Q3 order_* if m_Block1and2_rnd=="randomize(0, [0,1])" [weight=W8], robust
est store model6

esttab model1 model2 model3 model4 model5 model6 using models.csv, b(2) se(2) r2 replace



***** Table A4: Question Order in the US

use "CCES16_DKA_OUTPUT_Feb2017_unmatched.dta", replace

tab rand307_309, gen(order_)

* workers in labor force
regress DKA307 order_2 order_1 order_3 order_5 order_4 if DKA307!=-8 [weight=weight], robust
est store model1

* workers in office
regress DKA308 order_2 order_1 order_3 order_5 order_4 if DKA308!=-8 [weight=weight], robust
est store model2

* ideal workers in office 
regress DKA309 order_2 order_1 order_3 order_5 order_4 if DKA309!=-8 [weight=weight], robust
est store model3

esttab model1 model2 model3 using models.csv, b(2) se(2) r2 replace



**** Table A5: Block Order Effects in Britain 

use "VanderbiltUniversity_160728_Client_V2.dta" , replace

tab m_Block1and2_rnd, gen(blockorder_)

*women: public, office, ideal office

regress Q5 blockorder_1 [weight=W8], robust
est store model1

regress Q6 blockorder_1 [weight=W8], robust
est store model2

regress Q7 blockorder_1 [weight=W8], robust
est store model3


*workers: public, office, ideal office
regress Q1 blockorder_1 [weight=W8], robust
est store model4

regress Q2 blockorder_1 [weight=W8], robust
est store model5

regress Q3 blockorder_1 [weight=W8], robust
est store model6


esttab model1 model2 model3 model4 model5 model6 using models.csv, b(2) se(2) r2 replace



***** Table A6: Level of Gov’t Effects in the US

use "CCES16_DKA_OUTPUT_Feb2017_unmatched.dta", replace

* workers in labor force
regress DKA307 i.DKA306rand if DKA307!=-8 [weight=weight], robust
est store model1

* workers in office
regress DKA308 i.DKA306rand if DKA308!=-8 [weight=weight], robust
est store model2

* ideal workers in office 
regress DKA309 i.DKA306rand if DKA309!=-8 [weight=weight], robust
est store model3

esttab model1 model2 model3 using models.csv, b(2) se(2) r2 replace

*  Group A (member of Congress), Group B (state legislator in your state), or Group C (the people on your town's city council). 

tab DKA306rand [aweight=weight] if DKA307!=-8, sum(DKA307)
tab DKA306rand [aweight=weight] if DKA308!=-8, sum(DKA308)
tab DKA306rand [aweight=weight] if DKA309!=-8, sum(DKA309)


**** Table 2: estimates summarize full models in Tables A7-A9



**** Table A7

use "APES 2015 panel v7.dta", clear

gen idealMINUSperceived=P91_w2 - P90_w2 if P91_w2 <=100 & P90_w2<=100

gen attendmtg = 0 if P29_4!=88 | P29_5!=88 | P23_4_w2!=88 | P23_5_w2!=88
replace attendmtg = 1 if (P29_4>=1 & P29_4<=3) | (P29_5>=1 & P29_5<=3) | (P23_4_w2>=1 & P23_4_w2<=3) | (P23_5_w2>=1 & P23_5_w2<=3)

gen protest = 0 if P24_1_w2==2 | P24_2_w2==2 | P24_3_w2==2
replace protest = 1 if P24_1_w2==1 | P24_2_w2==1 | P24_3_w2==1

gen badpolitics = 0 if P1_w2>=1 & P1_w2<=16
replace badpolitics=1 if P1_w2==2 | P1_w2==11

gen scioli = 0 if (P27_abierta_w2>=1 & P27_abierta_w2<=10) | (P27_cerrada_w2>=1 & P27_cerrada_w2<=10)
replace scioli= 1 if P27_abierta_w2==1 | P27_cerrada_w2==1

gen turnout = 1 if (P27_abierta_w2>=1 & P27_abierta_w2<=10) | (P27_cerrada_w2>=1 & P27_cerrada_w2<=10)
replace turnout = 0 if P27_abierta_w2==98

gen female = (sexo==2)
rename edad age

gen educ = P102_w2 if P102_w2<11
replace educ = P89b if P89b<11 & educ==.

gen ideol = P39_w2 if P39_w2<11
replace ideol = P36 if P36<11 & ideol==.

foreach x of numlist 1(1)10 {
	gen item`x' = P136_`x'_w2
	replace item`x' = P125_`x' if item`x'==.
}
factor item1-item10, pcf
predict wealthx
xtile wealth = wealthx, n(5)

gen know1_cor = (P71_w2==2)
gen know2_cor = (P72_w2==3)
gen know3_cor = (P74_w2==4)
gen know4_cor = (P75_w2==2)
gen know5_cor = (P76_w2==2)
factor know1_cor-know5_cor, pcf
alpha know1_cor-know5_cor
predict knowledgex
xtile knowledge = knowledgex, n(3)

gen idealMINUSperceived01 = idealMINUSperceived/100

reg idealMINUSperceived01 ideol knowledge wealth educ age female [weight=weight], robust
est store model1 

reg attendmtg idealMINUSperceived01 ideol knowledge wealth educ age female [weight=weight], robust
est store model2

reg protest idealMINUSperceived01 ideol knowledge wealth educ age female [weight=weight], robust
est store model3

reg scioli idealMINUSperceived01 ideol knowledge wealth educ age female [weight=weight], robust
est store model4

reg badpolitics idealMINUSperceived01 ideol knowledge wealth educ age female [weight=weight], robust
est store model5 

reg turnout idealMINUSperceived01 ideol knowledge wealth educ age female [weight=weight], robust
est store model6

esttab model1 model2 model3 model6 model4 model5  using models.csv, b(2) se(2) r2 replace

* check that linearity assumption isn't somehow affecting results (not reported in manuscript)

reg attendmtg idealMINUSperceived01 i.ideol i.knowledge i.wealth i.educ i.age i.female [weight=weight], robust
reg protest idealMINUSperceived01 i.ideol i.knowledge i.wealth i.educ i.age i.female  [weight=weight], robust
reg scioli idealMINUSperceived01 i.ideol i.knowledge i.wealth i.educ i.age i.female  [weight=weight], robust
reg badpolitics idealMINUSperceived01 i.ideol i.knowledge i.wealth i.educ i.age i.female [weight=weight], robust
reg turnout idealMINUSperceived01 ideol i.ideol i.knowledge i.wealth i.educ i.age i.female  [weight=weight], robust


**** Table A8

* Britain

* set directory to folder where data are stored
use "VanderbiltUniversity_160728_Client_V2.dta" , replace

gen Q17a_cor = (Q17a==1)
gen Q17b_cor = (Q17b==1)
gen Q17c_cor = (Q17c==2)
gen Q17d_cor = (Q17d==1)
gen Q17e_cor = (Q17e==1)
factor Q17a_cor-Q17e_cor, pcf
alpha Q17a_cor-Q17e_cor
predict knowledgex
xtile knowledge = knowledgex, n(4)

replace Profile_gender = Profile_gender-1
gen idealMINUSperceived= Q3-Q1 
gen idealMINUSperceived01 = idealMINUSperceived/100
gen attendmtg = 0 if Q15==4 & Q16==4	
replace attendmtg = 1 if Q15==1 | Q15==2 | Q15==3 | Q16==1 | Q16==2 | Q16==3
gen protest = (Q14- 2)*(-1) if Q14!=3

regress idealMINUSperceived01 Q12 knowledge Profile_gross_household Profile_education_age Age Profile_gender [weight=W8], robust
est store model1 

regress attendmtg idealMINUSperceived01 Q12 knowledge Profile_gross_household Profile_education_age Age Profile_gender [weight=W8], robust
est store model2

regress protest idealMINUSperceived01 Q12 knowledge Profile_gross_household Profile_education_age Age Profile_gender [weight=W8], robust
est store model3

esttab model1 model2 model3 using models.csv, b(2) se(2) r2 replace


* check that linearity assumption isn't somehow affecting results (not reported in manuscript)

regress attendmtg idealMINUSperceived01 i.Q12 i.knowledge i.Profile_gross_household i.Profile_education_age i.Age i.Profile_gender [weight=W8], robust
regress protest idealMINUSperceived01 i.Q12 i.knowledge i.Profile_gross_household i.Profile_education_age i.Age i.Profile_gender  [weight=W8], robust

**** Table A9 

* set directory to folder where data are stored
use "CCES16_DKA_OUTPUT_Feb2017_unmatched.dta", replace

gen idealMINUSperceived= DKA309- DKA307 if DKA307!=-8 & DKA309!=-8


gen attendmtg= (CC16_417a_1 - 2)*(-1)
gen turnout = 0 if CC16_401 >=1 & CC16_401<=4
replace turnout = 1 if CC16_401 ==5
gen workcandidate = (CC16_417a_3 - 2)*(-1)
gen disapprove=0 if CC16_320b!=8 & CC16_320b!=.
replace disapprove = 1 if CC16_320b==3 | CC16_320b==4
gen trump = 0 if CC16_410a==2
replace trump = 1 if CC16_410a==1

gen idealMINUSperceived01 = idealMINUSperceived/100

gen knowledge = 0
replace knowledge = 1 if CC16_321a==1
replace knowledge = 2 if CC16_321b==1

regress idealMINUSperceived01 CC16_340a knowledge faminc educ birthyr gender if CC16_340a<8 [weight=weight], robust
est store model1 

regress attendmtg idealMINUSperceived01 CC16_340a knowledge faminc educ birthyr gender if CC16_340a<8 [weight=weight], robust
est store model2

regress workcandidate idealMINUSperceived01 CC16_340a knowledge faminc educ birthyr gender if CC16_340a<8 [weight=weight], robust
est store model3

regress trump idealMINUSperceived01 CC16_340a knowledge faminc educ birthyr gender if CC16_340a<8 [weight=weight], robust
est store model4

regress disapprove idealMINUSperceived01 CC16_340a knowledge faminc educ birthyr gender if CC16_340a<8 [weight=weight], robust
est store model5

regress turnout idealMINUSperceived01 CC16_340a knowledge faminc educ birthyr gender if CC16_340a<8 [weight=weight], robust
est store model6

esttab model1 model2 model3 model6 model4 model5  using models.csv, b(2) se(2) r2 replace

* check that linearity assumption isn't somehow affecting results (not reported in manuscript)

regress attendmtg idealMINUSperceived01 i.CC16_340a i.knowledge i.faminc i.educ i.birthyr i.gender if CC16_340a<8 [weight=weight], robust
regress workcandidate idealMINUSperceived01 i.CC16_340a i.knowledge i.faminc i.educ i.birthyr i.gender  if CC16_340a<8 [weight=weight], robust
regress trump idealMINUSperceived01 i.CC16_340a i.knowledge i.faminc i.educ i.birthyr i.gender  if CC16_340a<8 [weight=weight], robust
regress disapprove idealMINUSperceived01 i.CC16_340a i.knowledge i.faminc i.educ i.birthyr i.gender  if CC16_340a<8 [weight=weight], robust
regress turnout idealMINUSperceived01 i.CC16_340a i.knowledge i.faminc i.educ i.birthyr i.gender  if CC16_340a<8 [weight=weight], robust
